/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ambartakip;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author monelge
 */
public class _DataBase {
static ResultSet rs;
static Statement stmt;
    public static ResultSet datatable(String sorgu) {
        try {
            
            String connectionString = "jdbc:jtds:sqlserver://mehmetonelge.com/hatay2014";
            String userName = "tasimacilik";
            String password = "144522ma";

            Class.forName("net.sourceforge.jtds.jdbc.Driver"); //specify the jtds driver
            Connection conn = DriverManager.getConnection(connectionString, userName, password); //establish connection
            System.out.println("Connection properly established");

            

            stmt = conn.createStatement();
            rs = stmt.executeQuery(sorgu);

        } catch (ClassNotFoundException | SQLException e) {
            System.out.println(e.getMessage());
        }

        return rs;
    }
}
